<?php

class MasterController {
	
	private $m_memberController;
	
	public function __construct ($memberController){
		$this->m_memberController = $memberController;
	}
	
	public function DoControl (){
	$navigationView = new NavigationView();
		//Handle active controller
		$controllerOutput = $this -> HandleActiveController($navigationView);		

		return $controllerOutput;
	}

	private function HandleActiveController(NavigationView $navigationView) {
		$userViews = $navigationView -> GetActiveControllerType();

		switch ($userViews) {
			case NavigationView::USERVIEWSLOGGEDINPAGE :
				$activeController = $this->m_memberController;
				break;
				
				default ://User haven't selected anything
				$activeController = $this->m_memberController;
		}
		//The active controller generates output
		return $activeController->DoControl();		
	
	}
}